package com.turing;

import com.turing.config.MyBatisConfig;
import com.turing.mapper.UserMapper;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;


public class MainStarter {

	public static void main(String[] args) {
		// 记载spring上下文
		AnnotationConfigApplicationContext ioc = new AnnotationConfigApplicationContext(MyBatisConfig.class);
		UserMapper bean = (UserMapper) ioc.getBean("userMapper");
		// UserMapper bean = (UserMapper) ioc.getBean("userMapper2");
		System.out.println(bean.selectById(1L));

		/*UserMapper userMapper =(UserMapper) Proxy.newProxyInstance(UserMapper.class.getClassLoader(), new Class[]{UserMapper.class}, (proxy, method, args1) -> {
			// 查询数据库...
			System.out.println("查询");
			return new User();
		});
		userMapper.selectById(1L);*/
	}
}
